from rest_framework import serializers
from rest_framework import viewsets
from django.core.serializers import serialize as ser
from .models import Music, Singer


class MusicSerializer(serializers.ModelSerializer):
    # music_singer_name = serializers.SerializerMethodField()

    class Meta:
        model = Music
        fields = ('music_name', 'music_singer_name', "music_duration")

    # def get_music_singer_name(self, obj):
    #     return ser("json", obj.music_singer.all())


class SingerSerializer(serializers.ModelSerializer):

    class Meta:
        model = Singer
        fields = ("singer_name", "singer_img_add")


